Release reused diffusion cache before VAE decode#136
Draft
Paul (nuclearspike) wants to merge 1 commit into
Draft
Release reused diffusion cache before VAE decode#136Paul (nuclearspike) wants to merge 1 commit into
Paul (nuclearspike) wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
The generation-scoped cache retained the reused transformer after the second diffusion stage. On Apple Silicon this allowed roughly 37 GiB of transformer state to overlap tiled VAE decoding. A live 1280x704 run with that lifetime peaked at 46.7 GiB of MPS driver memory and still had 35.4 GiB torch-allocated after output encoding. The cache only needs to survive the boundary between the two identical diffusion stages.
Apple Silicon HD A/B
Workload: Fast pipeline, 1280x704, 121 frames, 24 fps (5.04 seconds), fixed prompt and seed. Two fresh runs per condition.
All four measured MP4s had the same SHA-256 (
7e82...78aa); the comparison reported 99 dB PSNR. The timing result is directional because each condition has only two runs; the memory/lifetime fix is the primary motivation.Validation
pnpm backend:test— 568 passedpnpm typecheck— TypeScript clean; Pyright 0 errors/0 warningspnpm build:frontend— production build passedpnpm openapi:check— generated schema/types currentReview note
This is a draft so the newly enabled default can receive cross-platform/CUDA validation before merge.